﻿using System;
using System.Text;

namespace Common.Security
{
    /// <summary>
    /// Allows generating an internal password so that it does not need to be stored as string.
    /// </summary>
    internal class MasterPasswordGenerator
    {
        private readonly byte[] _masterpassword = new byte[41];

        /// <summary>
        /// CTOR
        /// </summary>
        public MasterPasswordGenerator()
        {
            var r = new Random(3291);
            r.NextBytes(_masterpassword);
        }

        /// <summary>
        /// Returns the generated password.
        /// </summary>
        /// <returns>password</returns>
        public string GetPassword()
        {
            return Encoding.ASCII.GetString(_masterpassword);
        }
    }
}